﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AddIn.EA.Architecture.ComponentLogic.EAConverter
{
    public abstract class EAConverter
    {
        public abstract Framework.Common.IElement ConvertObject(ElementModel.BaseModel sourceElement, Framework.Common.IElement affectedElement);

        protected void BindAttributeTaggedValues(AddIn.EA.Framework.AttributeClass attribute, List<AddIn.EA.Architecture.ComponentLogic.ElementModel.AttributeTag> list)
        {
            if (list != null && list.Count > 0)
            {
                foreach (ComponentLogic.ElementModel.AttributeTag itemTag in list)
                {
                    Framework.AttributeTag tag = attribute.TaggedValues.AddNew(itemTag.Name);
                    tag.Notes = itemTag.Notes;
                    tag.Value = itemTag.Value;
                }
            }
        }
        protected void BindElementTaggedValues(AddIn.EA.Framework.Element destinationElement, List<AddIn.EA.Architecture.ComponentLogic.ElementModel.TaggedValue> list)
        {
            if (list != null && list.Count > 0)
            {
                foreach (ElementModel.TaggedValue itemTag in list)
                {
                    Framework.TaggedValue tag = destinationElement.TaggedValues.AddNew(itemTag.Name);
                    tag.Notes = itemTag.Notes;
                    tag.Value = itemTag.Value;
                }
            }
        }
    }
}
